package com.org.javabody.return_api;

/**
 *  跳出多个循环的方法(利用返回值进行跳出,break无法跳出多循环)
 * Created by Administrator on 2017-01-17.
 */
public class BreakManyTimes {

    public static int getData() {
        int temp = 0;
        for (int i=0; i<5; i++) {
            for(int j=0; j < 5; j++) {
                for (int k=0; k <10; k++) {
                      if(k==2) {
                          temp = i+j+k;
                          return temp;
                      }
                }
            }
        }
        return temp;
    }

    public static void main(String[] args) {

        int data = BreakManyTimes.getData();
        System.out.println(data);
    }
}
